function generateCleanTranslations(){function e(e){var a={},t=[];for(var n in usedTranslations)t.push(n);t.sort();var a="{\n";t.forEach(function(n,s){if(void 0===e[n])alert("Translation was requested but not found for: "+n);else{var l="";s+1<t.length&&(l=","),a+='  "'+n+'": '+JSON.stringify(e[n].message)+l+"\n"}}),a+="}",console.log(a)}$.ajax({async:!1,type:"GET",url:"/lang/en.json",success:function(a){e(JSON.parse(a))}}),$.ajax({async:!1,type:"GET",url:"/lang/zh.json",success:function(a){e(JSON.parse(a))}})}function translateAll(){function e(){setLanguage($(this).val()),$(".tab-autocontrol select.dropdownScripts").html("")}switch(registerWords(),localStorage.getItem("lang")){case"en":setLanguage("en");break;case"zh":setLanguage("zh");break;default:setLanguage("en")}$("#selectlanguage").change(e)}function setLanguage(e){translate(e),localStorage.setItem("lang",e)}function translate(e){null!=localStorage.getItem(e+"Data")?dict=JSON.parse(localStorage.getItem(e+"Data")):loadDict(),$("[i18n]").each(function(){switch(this.tagName.toLowerCase()){case"input":$(this).val(getMessage($(this).attr("i18n")));break;default:$(this).html(getMessage($(this).attr("i18n")))}})}function getMessage(e,a){return parametersForTranslation[e]=a,buildMessage(e)}function buildMessage(e){var a=e;if(void 0!==dict[e])a=dict[e];else if(!isEmpty(dict)){var t=localStorage.getItem("lang")||"en";console.error("Missing translation for "+t+": "+e),googleAnalytics.sendEvent("MissingTranslation",t+":"+e)}var n=a.split("$"),s="";return n.forEach(function(a,t){if(0===t)s+=a;else{var n=a.substring(0,1),l=parametersForTranslation[e][n-1];s+=l,s+=a.substring(1)}}),usedTranslations[e]=!0,s}function loadDict(e){var a=localStorage.getItem("lang")||"en";$.ajax({async:!1,type:"GET",url:"/lang/"+a+".json",success:function(a){dict=JSON.parse(a),e&&e()}})}function registerWords(){switch($("[i18n]:not(.i18n-replaced").each(function(){var e=$(this);e.html(getMessage(e.attr("i18n"))),e.addClass("i18n-replaced")}),$("[i18n_title]:not(.i18n_title-replaced").each(function(){var e=$(this);e.attr("title",getMessage(e.attr("i18n_title"))),e.addClass("i18n_title-replaced")}),$("[i18n_value]:not(.i18n_value-replaced").each(function(){var e=$(this);e.val(getMessage(e.attr("i18n_value"))),e.addClass("i18n_value-replaced")}),$("[i18n_placeholder]:not(.i18n_placeholder-replaced").each(function(){var e=$(this);e.attr("placeholder",getMessage(e.attr("i18n_placeholder"))),e.addClass("i18n_placeholder-replaced")}),$("#safetyDialog").prop("title",getMessage("safetyAgreement")),localStorage.getItem("lang")){case"zh":$("#tabContent .titles").height(40);break;default:$("#tabContent .titles").height(20)}}var dict={},usedTranslations={},parametersForTranslation={};